package pers.qianyu.module.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.qianyu.module.core.comm.HttpResult;
import pers.qianyu.module.core.domain.system.vo.ChartInfoVO;
import pers.qianyu.module.core.domain.system.vo.StatisticInfoVO;
import pers.qianyu.module.system.service.StatisticInfoService;

/**
 * @author mizzle rain
 * @date 2021-05-02 14:19
 */
@Api(tags = "网站统计功能相关接口")
@RestController
@RequestMapping("system-serv")
public class StatisticController {
    @Autowired
    private StatisticInfoService statisticInfoService;

    @ApiOperation("获取网站统计信息")
    @GetMapping("/statistic")
    public HttpResult<StatisticInfoVO> getStatisticInfo() {
        StatisticInfoVO statisticInfo = statisticInfoService.getStatisticInfo();
        return HttpResult.okWithData(statisticInfo);
    }

    @ApiOperation("获取网站近7天访问量")
    @GetMapping("/chart")
    public HttpResult<ChartInfoVO> getChartInfo() {
        ChartInfoVO chartInfoVO = statisticInfoService.getChartInfo();
        return HttpResult.okWithData(chartInfoVO);
    }
}
